Skip to content

refactor/sync flag#3793

Merged
fiftin merged 17 commits intodevelopfrom
refactor/sync_flag
Apr 24, 2026
Merged

refactor/sync flag#3793
fiftin merged 17 commits intodevelopfrom
refactor/sync_flag

Conversation

@fiftin
Copy link
Copy Markdown
Collaborator

@fiftin fiftin commented Apr 19, 2026

  • feat(secrets): add sync flag and sync paths table
  • fix(secrets): layout
  • feat(secrets): auto sync

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc0ccade0c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread db/sql/secret_storage.go Outdated
Comment thread cli/cmd/root.go
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Security review (PR 3793)

Outcome: No medium, high, or critical vulnerabilities were identified in the added or modified code after tracing attacker-controlled inputs to sinks and checking existing controls (parameterized SQL, project-scoped middleware, API field handling).

Prior threads: Previous automation findings were re-evaluated against the current diff; none warranted re-reporting with a concrete exploit path tied to this change set.

Notes (non-findings):

  • project__secret_sync inserts use bound parameters; path/prefix/separator values are not concatenated into SQL.
  • Manual SyncSecrets uses storage from middleware; sync config is loaded by storage_id with the same scope.
  • GetAppSysProcAttr applies optional Linux namespaces only to app runners; git continues to use GetSysProcAttr (per code comments and CmdGitClient).
  • Pro SyncSecrets is currently a stub returning nil; scheduler work is effectively no-op until implemented—treated as incomplete feature surface, not a demonstrated vulnerability in this PR.
Open in Web View Automation 

Sent by Cursor Automation: Find vulnerabilities

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Security review (sync flag refactor)

Outcome: One high finding remains: secret storage deletion can leave orphaned secrets in external secret backends when sync had imported keys.

Not reported: SyncSecrets is a no-op in OSS/pro stub (no SSRF/injection from sync execution in this diff). SQL uses parameterized queries. Synchronized is forced server-side on create/update. Linux namespace flags are opt-in config.

Slack-ready summary: PR #37931 high: deleting a sync-enabled secret storage bulk-deletes imported keys with DeleteAccessKey only, skipping DeleteSecret / deserializer cleanup, so Vault/AWS SM/Azure KV entries can survive after the Semaphore row is gone.

Open in Web View Automation 

Sent by Cursor Automation: Find vulnerabilities

Comment thread services/server/secret_storage_svc.go
…or/sync-flag

Gate secret sync scheduler to a single HA worker
@fiftin fiftin merged commit ebd41b9 into develop Apr 24, 2026
19 checks passed
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security review (PR 3793)

Verdict: One high-severity issue remains: environment secret-sync persistence trusts client-supplied secret_storage_id without verifying the storage belongs to the same project as the environment, so a project member can point sync config at another project's secret storage (IDOR / cross-tenant data boundary). Other changes (parameterized SQL, sync stub, namespace split for app vs git, key synchronized hardening) did not surface additional high-confidence exploit paths in this diff.

Slack (copy/paste): PR 3793 — 1 High: cross-project secret_storage_id in saveEnvironmentSync lets env updates attach sync rows to arbitrary storage_id; fix by validating GetSecretStorage(env.ProjectID, *SecretStorageID) before SaveSecretSync. No other medium+ findings from this pass.

Open in Web View Automation 

Sent by Cursor Automation: Find vulnerabilities

Comment thread db/sql/environment.go
EnvironmentID: &envID,
}
if env.SecretStorageID != nil {
sync.StorageID = *env.SecretStorageID
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High — IDOR / cross-project secret storage binding

saveEnvironmentSync copies env.SecretStorageID from the JSON body into sync.StorageID without checking that that storage row belongs to env.ProjectID. A user with access to project A can set secret_storage_id to a storage ID from project B (guessed or observed); the FK only constrains storage_id to exist somewhere in project__secret_storage, not to match the environment's project. project_id on the sync row stays A while storage_id points at B's vault — wrong data boundary and a plausible path to future sync/import logic operating on another tenant's backend once implemented.

Fix: Before persisting, load the storage with GetSecretStorage(env.ProjectID, *env.SecretStorageID) (or equivalent) and reject on ErrNotFound / mismatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant